<?php

class special_courses {
	
	/**
	 * Название кафедры
	 * @var string
	 */
	private $department_name = NULL;
	
	function __construct() {
		
	}
	
	function __destruct() {
		
	}
	
	function set_department_name($department_name) {
		$this->department_name = $department_name;
	}
	
	/**
	 * Возвращает названия спецкурсов
	 * @return array(
	 * 	[#]
	 * 		['id'] => int
	 * 		['fullname'] => string
	 * )
	 */
	function get_courses() {
		global $DB;
		
		$sql = file_get_contents(__DIR__ . '/sql/get_courses.sql');
		
		$stmt = $DB->prepare($sql);
		$stmt->bind_param('s', $this->department_name);
		$stmt->execute();
		
		return $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
	}
}

?>
